<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">aib.c File Reference</div>  </div>
</div>
<div class="contents">

<p>AIB - Definition.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="aib_8h.html">aib.h</a>&quot;</code><br/>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;float.h&gt;</code><br/>
<code>#include &lt;math.h&gt;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a14bc24cb8ad409132d16de6e3f27b002">vl_aib_normalize_P</a> (double *P, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nelem)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Normalizes an array of probabilities to sum to 1.  <a href="#a14bc24cb8ad409132d16de6e3f27b002"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#af4a8a12f8fa47997c140b43cd993dc30">vl_aib_new_nodelist</a> (<a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nentries)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and creates a list of nodes.  <a href="#af4a8a12f8fa47997c140b43cd993dc30"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a9b903a69b8d1167f48cfe1e00a9e1d33">vl_aib_new_Px</a> (double *Pcx, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nvalues, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nlabels)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and creates the marginal distribution Px.  <a href="#a9b903a69b8d1167f48cfe1e00a9e1d33"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a171cd4a6e0622a97286a0a2b2130841c">vl_aib_new_Pc</a> (double *Pcx, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nvalues, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nlabels)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and creates the marginal distribution Pc.  <a href="#a171cd4a6e0622a97286a0a2b2130841c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#aa567101e4f0835b9a73a9b037afa0953">vl_aib_min_beta</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *besti, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *bestj, double *minbeta)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Find the two nodes which have minimum beta.  <a href="#aa567101e4f0835b9a73a9b037afa0953"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a4b04bbe5d45b4a9fd84aecb173fbab93">vl_aib_merge_nodes</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> i, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> j, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> new)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Merges two nodes i,j in the internal datastructure.  <a href="#a4b04bbe5d45b4a9fd84aecb173fbab93"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a474eae5c9436f86251eea120221e8bd1">vl_aib_update_beta</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates <code>aib-&gt;beta</code> and <code>aib-&gt;bidx</code> according to <code>aib-&gt;which</code>.  <a href="#a474eae5c9436f86251eea120221e8bd1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a531a6f39064384f6728df5a1641d7f54">vl_aib_calculate_information</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib, double *I, double *H)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the current information and entropy.  <a href="#a531a6f39064384f6728df5a1641d7f54"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a4bb02325ebe150348976dbb46183f8f3">vl_aib_new</a> (double *Pcx, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nvalues, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nlabels)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and initializes the internal data structure.  <a href="#a4bb02325ebe150348976dbb46183f8f3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a145bb0e2d8f512613e8fd3fb92fe7ace">vl_aib_delete</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes AIB data structure.  <a href="#a145bb0e2d8f512613e8fd3fb92fe7ace"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8c.html#a2adbc69469a6200896e6582474c398ee">vl_aib_process</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Runs AIB on Pcx.  <a href="#a2adbc69469a6200896e6582474c398ee"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Brian Fulkerson </dd>
<dd>
Andrea Vedaldi </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a531a6f39064384f6728df5a1641d7f54"></a><!-- doxytag: member="aib.c::vl_aib_calculate_information" ref="a531a6f39064384f6728df5a1641d7f54" args="(VlAIB *aib, double *I, double *H)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_calculate_information </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>I</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>H</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>A pointer to the internal data structure </td></tr>
    <tr><td class="paramname">I</td><td>The current mutual information (out). </td></tr>
    <tr><td class="paramname">H</td><td>The current entropy (out).</td></tr>
  </table>
  </dd>
</dl>
<p>Calculates the current mutual information and entropy of Pcx and sets <em>I</em> and <em>H</em> to these new values. </p>

</div>
</div>
<a class="anchor" id="a145bb0e2d8f512613e8fd3fb92fe7ace"></a><!-- doxytag: member="aib.c::vl_aib_delete" ref="a145bb0e2d8f512613e8fd3fb92fe7ace" args="(VlAIB *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>data structure to delete. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a4b04bbe5d45b4a9fd84aecb173fbab93"></a><!-- doxytag: member="aib.c::vl_aib_merge_nodes" ref="a4b04bbe5d45b4a9fd84aecb173fbab93" args="(VlAIB *aib, vl_uint i, vl_uint j, vl_uint new)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_merge_nodes </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>i</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>j</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>new</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>A pointer to the internal data structure </td></tr>
    <tr><td class="paramname">i</td><td>The index of one member of the pair to merge </td></tr>
    <tr><td class="paramname">j</td><td>The index of the other member of the pair to merge </td></tr>
    <tr><td class="paramname">new</td><td>The index of the new node which corresponds to the union of (<em>i</em>, <em>j</em>).</td></tr>
  </table>
  </dd>
</dl>
<p>Nodes are merged by replacing the entry <em>i</em> with the union of <code>ij</code>, moving the node stored in last position (called <code>lastnode</code>) back to jth position and the entry at the end.</p>
<p>After the nodes have been merged, it updates which nodes should be considered on the next iteration based on which beta values could potentially change. The merged node will always be part of this list. </p>

</div>
</div>
<a class="anchor" id="aa567101e4f0835b9a73a9b037afa0953"></a><!-- doxytag: member="aib.c::vl_aib_min_beta" ref="aa567101e4f0835b9a73a9b037afa0953" args="(VlAIB *aib, vl_uint *besti, vl_uint *bestj, double *minbeta)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_min_beta </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *&#160;</td>
          <td class="paramname"><em>besti</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *&#160;</td>
          <td class="paramname"><em>bestj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>minbeta</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>A pointer to the internal data structure </td></tr>
    <tr><td class="paramname">besti</td><td>The index of one member of the pair which has mininum beta </td></tr>
    <tr><td class="paramname">bestj</td><td>The index of the other member of the pair which minimizes beta </td></tr>
    <tr><td class="paramname">minbeta</td><td>The minimum beta value corresponding to (<em>i</em>, <em>j</em>)</td></tr>
  </table>
  </dd>
</dl>
<p>Searches <em>aib-&gt;beta</em> to find the minimum value and fills <em>minbeta</em> and <em>besti</em> and <em>bestj</em> with this information. </p>

</div>
</div>
<a class="anchor" id="a4bb02325ebe150348976dbb46183f8f3"></a><!-- doxytag: member="aib.c::vl_aib_new" ref="a4bb02325ebe150348976dbb46183f8f3" args="(double *Pcx, vl_uint nvalues, vl_uint nlabels)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structVlAIB.html">VlAIB</a>* vl_aib_new </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>Pcx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nvalues</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nlabels</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">Pcx</td><td>A pointer to a 2D array of probabilities </td></tr>
    <tr><td class="paramname">nvalues</td><td>The number of rows in the array </td></tr>
    <tr><td class="paramname">nlabels</td><td>The number of columns in the array</td></tr>
  </table>
  </dd>
</dl>
<p>Creates a new <em><a class="el" href="structVlAIB.html" title="AIB algorithm data.">VlAIB</a></em> struct containing pointers to all the data that will be used during the AIB process.</p>
<p>Allocates memory for the following:</p>
<ul>
<li>Px (nvalues*sizeof(double))</li>
<li>Pc (nlabels*sizeof(double))</li>
<li>nodelist (nvalues*sizeof(vl_uint))</li>
<li>which (nvalues*sizeof(vl_uint))</li>
<li>beta (nvalues*sizeof(double))</li>
<li>bidx (nvalues*sizeof(vl_uint))</li>
<li>parents ((2*nvalues-1)*sizeof(vl_uint))</li>
<li>costs (nvalues*sizeof(double))</li>
</ul>
<p>Since it simply copies to pointer to Pcx, the total additional memory requirement is:</p>
<p>(3*nvalues+nlabels)*sizeof(double) + 4*nvalues*sizeof(vl_uint)</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An allocated and initialized <em><a class="el" href="structVlAIB.html" title="AIB algorithm data.">VlAIB</a></em> pointer </dd></dl>

</div>
</div>
<a class="anchor" id="af4a8a12f8fa47997c140b43cd993dc30"></a><!-- doxytag: member="aib.c::vl_aib_new_nodelist" ref="af4a8a12f8fa47997c140b43cd993dc30" args="(vl_uint nentries)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>* vl_aib_new_nodelist </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nentries</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nentries</td><td>The size of the list which will be created</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>an array containing elements 0...nentries </dd></dl>

</div>
</div>
<a class="anchor" id="a171cd4a6e0622a97286a0a2b2130841c"></a><!-- doxytag: member="aib.c::vl_aib_new_Pc" ref="a171cd4a6e0622a97286a0a2b2130841c" args="(double *Pcx, vl_uint nvalues, vl_uint nlabels)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double* vl_aib_new_Pc </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>Pcx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nvalues</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nlabels</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">Pcx</td><td>A two-dimensional array of probabilities </td></tr>
    <tr><td class="paramname">nvalues</td><td>The number of rows in Pcx </td></tr>
    <tr><td class="paramname">nlabels</td><td>The number of columns in Pcx</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>an array of size <em>nlabels</em> which contains the marginal distribution over the columns </dd></dl>

</div>
</div>
<a class="anchor" id="a9b903a69b8d1167f48cfe1e00a9e1d33"></a><!-- doxytag: member="aib.c::vl_aib_new_Px" ref="a9b903a69b8d1167f48cfe1e00a9e1d33" args="(double *Pcx, vl_uint nvalues, vl_uint nlabels)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double* vl_aib_new_Px </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>Pcx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nvalues</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nlabels</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">Pcx</td><td>A two-dimensional array of probabilities </td></tr>
    <tr><td class="paramname">nvalues</td><td>The number of rows in Pcx </td></tr>
    <tr><td class="paramname">nlabels</td><td>The number of columns in Pcx</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>an array of size <em>nvalues</em> which contains the marginal distribution over the rows. </dd></dl>

</div>
</div>
<a class="anchor" id="a14bc24cb8ad409132d16de6e3f27b002"></a><!-- doxytag: member="aib.c::vl_aib_normalize_P" ref="a14bc24cb8ad409132d16de6e3f27b002" args="(double *P, vl_uint nelem)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_normalize_P </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>P</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nelem</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">P</td><td>The array of probabilities </td></tr>
    <tr><td class="paramname">nelem</td><td>The number of elements in the array</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Modifies P to contain values which sum to 1 </dd></dl>

</div>
</div>
<a class="anchor" id="a2adbc69469a6200896e6582474c398ee"></a><!-- doxytag: member="aib.c::vl_aib_process" ref="a2adbc69469a6200896e6582474c398ee" args="(VlAIB *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_process </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>AIB object to process</td></tr>
  </table>
  </dd>
</dl>
<p>The function runs Agglomerative Information Bottleneck (AIB) on the joint probability table <em>aib-&gt;Pcx</em> which has labels along the columns and feature values along the rows. AIB iteratively merges the two values of the feature <code>x</code> that causes the smallest decrease in mutual information between the random variables <code>x</code> and <code>c</code>.</p>
<p>Merge operations are arranged in a binary tree. The nodes of the tree correspond to the original feature values and any other value obtained as a result of a merge operation. The nodes are indexed in breadth-first order, starting from the leaves. The first index is zero. In this way, the leaves correspond directly to the original feature values. In total there are <code>2*nvalues-1</code> nodes.</p>
<p>The results may be accessed through vl_aib_get_parents which returns an array with one element per tree node. Each element is the index the parent node. The root parent is equal to zero. The array has <code>2*nvalues-1</code> elements.</p>
<p>Feature values with null probability are ignored by the algorithm and their nodes have parents indexing a non-existent tree node (a value bigger than <code>2*nvalues-1</code>).</p>
<p>Then the function will also compute the information level after each merge. vl_get_costs will return a vector with the information level after each merge. <em>cost</em> has <code>nvalues</code> entries: The first is the value of the cost functional before any merge, and the others are the cost after the <code>nvalues-1</code> merges. </p>

</div>
</div>
<a class="anchor" id="a474eae5c9436f86251eea120221e8bd1"></a><!-- doxytag: member="aib.c::vl_aib_update_beta" ref="a474eae5c9436f86251eea120221e8bd1" args="(VlAIB *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_update_beta </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>AIB data structure.</td></tr>
  </table>
  </dd>
</dl>
<p>The function calculates <code>beta</code>[i] and <code>bidx</code>[i] for the nodes <code>i</code> listed in <code>aib-&gt;which</code>. <code>beta</code>[i] is the minimal variation of mutual information (or other score) caused by merging entry <code>i</code> with another entry and <code>bidx</code>[i] is the index of this best matching entry.</p>
<p>Notice that for each entry <code>i</code> that we need to update, a full scan of all the other entries must be performed. </p>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
